/*
 * Created on Nov 12, 2003
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.vectrics.common.gen;


import java.util.Vector;
import org.vectrics.location.Address;
import org.vectrics.location.ZipInfo;


public class AddressGenerator {

	Vector streetList = new Vector();
	Vector streetPrefixList = new Vector();
	Vector streetSuffixList = new Vector();
	Vector zipList = new Vector();

	public AddressGenerator() {
		super();
		streetList.add("Elm");
		streetList.add("Oak");
		streetList.add("Moore");
		streetList.add("Main");
		streetList.add("Palmer");
		streetList.add("Pine");
		streetList.add("Thomson");
		streetList.add("Dell");
		streetList.add("Palm Grove");
		streetList.add("Nelson");
		streetList.add("Ida");
		streetList.add("Lowe");
		streetList.add("Lawson");
		streetList.add("Cedar");
		streetList.add("Miller");
		streetList.add("Lookout");
		streetList.add("Jones");
		streetList.add("London");
		streetList.add("Harvard");
		streetList.add("Oxford");
		streetList.add("Yale");
		streetList.add("Peak");
		streetList.add("Princeton");
		streetList.add("Valley");
		streetList.add("Paddle");
		
		streetPrefixList.add("");
		streetPrefixList.add("");
		streetPrefixList.add("");
		streetPrefixList.add("W.");
		streetPrefixList.add("S.");
		streetPrefixList.add("S.");
		streetPrefixList.add("W.");
		streetPrefixList.add("E.");

		streetSuffixList.add("Drive");
		streetSuffixList.add("Avenue");
		streetSuffixList.add("Court");
		streetSuffixList.add("Ave");
		streetSuffixList.add("St");
		streetSuffixList.add("Street");
		streetSuffixList.add("Ave");

		zipList.add(new ZipInfo("USA", "CO", "Ft. Morgan", "80344"));
		zipList.add(new ZipInfo("USA", "CO", "Ft. Morgan", "80341"));
		zipList.add(new ZipInfo("USA", "CO", "Ft. Collins", "80237"));
		zipList.add(new ZipInfo("USA", "CO", "Ft. Collins", "80234"));
		zipList.add(new ZipInfo("USA", "CO", "Ft. Collins", "80233"));
		zipList.add(new ZipInfo("USA", "CO", "Aurora", "80541"));
		zipList.add(new ZipInfo("USA", "CO", "Aurora", "80521"));
		zipList.add(new ZipInfo("USA", "CO", "Aurora", "80531"));
		zipList.add(new ZipInfo("USA", "CO", "Aurora", "80561"));
		zipList.add(new ZipInfo("USA", "CO", "Aurora", "80571"));
		zipList.add(new ZipInfo("USA", "CO", "Arvada", "80581"));
		zipList.add(new ZipInfo("USA", "CO", "Arvada", "80582"));
		zipList.add(new ZipInfo("USA", "CO", "Arvada", "80583"));
		zipList.add(new ZipInfo("USA", "CO", "Arvada", "80584"));
		zipList.add(new ZipInfo("USA", "CO", "Westminster", "80203"));
		zipList.add(new ZipInfo("USA", "CO", "Westminster", "80202"));
		zipList.add(new ZipInfo("USA", "CO", "Westminster", "80201"));
		zipList.add(new ZipInfo("USA", "CO", "Denver", "80231"));
		zipList.add(new ZipInfo("USA", "CO", "Denver", "80232"));
		zipList.add(new ZipInfo("USA", "CO", "Denver", "80233"));
		zipList.add(new ZipInfo("USA", "CO", "Denver", "80234"));
		zipList.add(new ZipInfo("USA", "CO", "Denver", "80235"));
		zipList.add(new ZipInfo("USA", "CO", "Littleton", "80127"));
		zipList.add(new ZipInfo("USA", "CO", "Littleton", "80128"));
		zipList.add(new ZipInfo("USA", "CO", "Littleton", "80129"));
		zipList.add(new ZipInfo("USA", "CO", "Littleton", "80130"));
		zipList.add(new ZipInfo("USA", "CO", "Lakewood", "80131"));
		zipList.add(new ZipInfo("USA", "CO", "Lakewood", "80132"));
		zipList.add(new ZipInfo("USA", "CO", "Lakewood", "80133"));
		zipList.add(new ZipInfo("USA", "CO", "Lakewood", "80134"));
		zipList.add(new ZipInfo("USA", "CO", "Brighton", "80140"));
		zipList.add(new ZipInfo("USA", "CO", "Brighton", "80141"));
		zipList.add(new ZipInfo("USA", "CO", "Brighton", "80142"));
		zipList.add(new ZipInfo("USA", "CO", "Thorton", "80143"));
		zipList.add(new ZipInfo("USA", "CO", "Thorton", "80144"));
		zipList.add(new ZipInfo("USA", "CO", "Englewood", "80146"));
		zipList.add(new ZipInfo("USA", "CO", "Englewood", "80147"));
		zipList.add(new ZipInfo("USA", "CO", "Cherry Hills", "80157"));
		zipList.add(new ZipInfo("USA", "CO", "Glendale", "80135"));
	}

	public void createAddress(Address address) {
		int streetListSize = streetList.size();
		int streetPrefixSize = streetPrefixList.size();
		int streetSuffixSize = streetSuffixList.size();
		int zipSize = zipList.size();
		
		int streetNumber = (int)(12000 * Math.random());
		int streetIndex = (int)(streetListSize * Math.random());
		int streetPrefixIndex = (int)(streetPrefixSize * Math.random());
		int streetSuffixIndex = (int)(streetSuffixSize * Math.random());
		int zipIndex = (int)(zipSize * Math.random());
		
		String streetName = (String)streetList.elementAt(streetIndex);
		String streetPrefix = (String)streetPrefixList.elementAt(streetPrefixIndex);
		if (streetPrefix.length() > 0) {
		 	streetPrefix = " ";
		}
		String streetSuffix = (String)streetSuffixList.elementAt(streetSuffixIndex);
		ZipInfo zipInfo = (ZipInfo)zipList.elementAt(zipIndex);		
		
		String street1 = "" + streetNumber + streetPrefix + " " + streetName + " " + streetSuffix;
		address.setAddress1(street1);
	//	address.setCity(zipInfo.getCity());
	//	address.setState(zipInfo.getState());
		address.setPostalCode(zipInfo.getZip());
	//	address.setCountryCode(zipInfo.getCountry());
		
	}

}
